/**
 * AUTHOR: Ice Zero
 * 
 */

// normal json object
const obj1 = {
  name: 'a',
  attr: {
    direction: 'forwards',
    age: 17
  },
  fun: {
    move: null
  },
  others: [1, 2, 3, 4]
};

const obj1_copy = {
  name: 'a',
  attr: {
    direction: 'forwards',
    age: 17
  },
  fun: {
    move: null
  },
  others: [1, 2, 3, 4]
};

const obj1_differ = {
  name: 'a',
  attr: {
    direction: 'forwards',
    age: 17
  },
  fun: {
    move: null
  },
  others: [1, 2, 3, 5]
};

const obj2 = {
  name: 'a',
  attr: {
    direction: 'forwards',
    age: 17
  },
  fun: {
    move: function () {
      console.log('move forwards');
    }
  },
  others: {
    a: 1,
    b: 2
  }
};

const obj2_copy = {
  name: 'a',
  attr: {
    direction: 'backwards',
    age: 17
  },
  fun: {
    move: function () {
      console.log('move backwards');
    }
  },
  others: {
    a: 1,
    b: 2
  }
};

function compare_simple_json(obj1, obj2) {
  console.log(JSON.stringify(obj1) === JSON.stringify(obj2));
}

compare_simple_json(obj1, obj1_copy);
compare_simple_json(obj1, obj1_differ);
compare_simple_json(obj2, obj2_copy);